package sk.hackcraft.util.generator;

import java.util.Random;

public class UniformDiscreteRandom implements DiscreteRandom
{
	private final int minValue;
	private final int maxValue;
	
	private final Random random;
	
	public UniformDiscreteRandom(int minValue, int maxValue)
	{
		this(SeedGenerator.getNextSeed(), minValue, maxValue);
	}
	
	public UniformDiscreteRandom(long seed, int minValue, int maxValue)
	{
		this.random = new Random(seed);
		this.minValue = minValue;
		this.maxValue = maxValue;
	}
	
	@Override
	public int next()
	{
		return minValue + random.nextInt(maxValue - minValue +1);
	}
}
